home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / src / xfprocConfig.tcl < prev    next >
Encoding:
Text File  |  1993-11-20  |  13.3 KB  |  507 lines

  1. # Program: xf
  2. # Description: procedures that implement the editing
  3. #
  4. # $Header: xfprocConfig.tcl[2.4] Wed Mar 10 12:07:45 1993 garfield@garfield frozen $
  5.  
  6. proc XFProcConfAddCurrentItem {xfType} {
  7. ##########
  8. # Procedure: XFProcConfAddCurrentItem
  9. # Description: insert the currently selected type of item
  10. # Arguments: xfType - type of inserting (add, config)
  11. # Returns: none
  12. # Sideeffects: none
  13. ##########
  14.  
  15.   global xfPath
  16.   global xfStatus
  17.  
  18.   set xfAddNumber 1
  19.   if {"[info commands .xfEdit.frame5.addNumber]" != ""} {
  20.     set xfAddNumber [.xfEdit.frame5.addNumber get]
  21.     .xfEdit.frame5.addNumber set 1
  22.   }
  23.   if {$xfStatus(itemList) == 2} {
  24.     set xfCounter 0
  25.     while {$xfCounter < $xfAddNumber} {
  26.       XFEditInsertTmplt $xfStatus(type)
  27.       incr xfCounter 1
  28.     }
  29.   } {
  30.     if {"[info procs XFAdd.$xfStatus(type)]" == ""} {
  31.       if {[file exists "$xfPath(elements)/$xfStatus(type)"]} {
  32.           source "$xfPath(elements)/$xfStatus(type)"
  33.       } {
  34.         foreach xfPathElement [split $xfPath(additionals) :] {
  35.           if {[XFMiscIsDir $xfPathElement]} {
  36.             if {[file exists "$xfPathElement/$xfStatus(type)"]} {
  37.               source "$xfPathElement/$xfStatus(type)"
  38.               break
  39.             }
  40.           }
  41.         }
  42.       }
  43.     }
  44.     if {"$xfType" == "add"} {
  45.       if {"[info procs XFAdd.$xfStatus(type)]" != ""} {
  46.         set xfCounter 0
  47.         while {$xfCounter < $xfAddNumber} {
  48.           if {[catch "XFAdd.$xfStatus(type) {} {} add" xfResult]} {
  49.             if {"$xfResult" != ""} {
  50.               XFProcError $xfResult
  51.             }
  52.             XFEditSetStatus "Insertion of widget...aborted"
  53.           }
  54.           incr xfCounter 1
  55.         }
  56.         if {"$xfStatus(type)" == "Toplevel"} {
  57.           XFEditSetShowWindows
  58.         }
  59.       }
  60.     } {
  61.       if {"[info procs XFAdd.$xfStatus(type)]" != ""} {
  62.         if {"[info procs XFAddTmp.$xfStatus(type)]" != ""} {
  63.           XFAddTmp.$xfStatus(type)
  64.         } {
  65.           catch "destroy .xfEdit.tmplt"
  66.           if {[catch "[string tolower $xfStatus(type)] .xfEdit.tmplt"]} {
  67.              XFProcConfConfigure undefined "" "" $xfStatus(type) add
  68.           } {
  69.              XFProcConfConfigure .xfEdit.tmplt "" "" $xfStatus(type) add
  70.           }
  71.         }
  72.       }
  73.     }
  74.   }
  75. }
  76.  
  77. proc XFProcConfBinding {{xfW ""} {xfLeader ""}} {
  78. ##########
  79. # Procedure: XFProcConfBinding
  80. # Description: call binding for the specified widget
  81. # Arguments: {xfW} - the widget to configure, or empty
  82. #                    to use current widget path
  83. #            {xfLeader} - the leading toplevel
  84. # Returns: none
  85. # Sideeffects: none
  86. ##########
  87.  
  88.   global xfStatus
  89.  
  90.   if {"$xfW" == ""} {
  91.     set xfW $xfStatus(path)
  92.   }
  93.   XFProcConfConfigure $xfW 3 $xfLeader
  94. }
  95.  
  96. proc XFProcConfBindingAll {} {
  97. ##########
  98. # Procedure: XFProcConfBindingAll
  99. # Description: call binding for the specified widget class
  100. # Arguments: none
  101. # Returns: none
  102. # Sideeffects: none
  103. ##########
  104.  
  105.   XFBinding all config all ""
  106. }
  107.  
  108. proc XFProcConfBindingClass {{xfClass ""}} {
  109. ##########
  110. # Procedure: XFProcConfBindingClass
  111. # Description: call binding for the specified widget class
  112. # Arguments: {xfClass} - the widget class to configure, or empty
  113. #                        to use current widget path
  114. # Returns: none
  115. # Sideeffects: none
  116. ##########
  117.  
  118.   XFBinding $xfClass config $xfClass ""
  119. }
  120.  
  121. ##########
  122. # Procedure: XFProcConfConfigure
  123. # Description: configure selected widget
  124. # Arguments: xfW - the widget to configure
  125. #            xfDialog - which type of configuration
  126. #                     0 = packing
  127. #                     1 = placing
  128. #                     2 = geometry
  129. #                     3 = bindings
  130. #                     4 = default parameters
  131. #                     5 = special parameters
  132. #                     .... more dialogs
  133. #            xfLeader - the leading window
  134. #            xfClass - the widget class we configure
  135. #            xfType - type of configuration (add, config)
  136. # Returns: none
  137. # Sideeffects: none
  138. ##########
  139. proc XFProcConfConfigure {xfW {xfDialog ""} {xfLeader ""} {xfClass ""} {xfType ""}} {
  140.   global xfConf
  141.   global xfDefaultConf
  142.   global xfNoSpecialBinding
  143.   global xfNoSpecialPacking
  144.   global xfNoSpecialPlacing
  145.   global xfPath
  146.  
  147.   if {"$xfW" != "." && "[info commands $xfW]" == ""} {
  148.     return
  149.   }
  150.   if {"$xfClass" == ""} {
  151.     if {"$xfW" == "."} {
  152.       set xfClass Toplevel
  153.     } {
  154.       set xfClass [winfo class $xfW]
  155.     }
  156.   }
  157.   if {$xfDialog == 0} {
  158.     if {[lsearch $xfNoSpecialPacking $xfClass] != -1} {
  159.       XFPacking $xfW $xfType $xfClass $xfLeader
  160.       return
  161.     }
  162.   } {
  163.     if {$xfDialog == 1} {
  164.       if {[lsearch $xfNoSpecialPlacing $xfClass] != -1} {
  165.         XFPlacing $xfW $xfType $xfClass $xfLeader
  166.         return
  167.       }
  168.     } {
  169.       if {$xfDialog == 2} {
  170.         if {"$xfConf(geometry)" == "packer"} {
  171.           if {[lsearch $xfNoSpecialPacking $xfClass] != -1} {
  172.             XFPacking $xfW $xfType $xfClass $xfLeader
  173.             return
  174.           }
  175.         } {
  176.           if {[lsearch $xfNoSpecialPlacing $xfClass] != -1} {
  177.             XFPlacing $xfW $xfType $xfClass $xfLeader
  178.             return
  179.           }
  180.         }
  181.       } {
  182.         if {$xfDialog == 3} {
  183.           if {[lsearch $xfNoSpecialBinding $xfClass] != -1} {
  184.             XFBinding $xfW $xfType $xfClass $xfLeader
  185.             return
  186.           }
  187.         }
  188.       }
  189.     }
  190.   }
  191.   if {"[info procs XFAdd.$xfClass]" == ""} {
  192.     if {[file exists "$xfPath(elements)/$xfClass"]} {
  193.       source "$xfPath(elements)/$xfClass"
  194.     } {
  195.       foreach xfPathElement [split $xfPath(additionals) :] {
  196.         if {[XFMiscIsDir $xfPathElement]} {
  197.           if {[file exists "$xfPathElement/$xfClass"]} {
  198.             source "$xfPathElement/$xfClass"
  199.             break
  200.           }
  201.         }
  202.       }
  203.     }
  204.   }
  205.   if {"$xfDialog" != ""} {
  206.     if {"[info proc XFConfig.$xfClass$xfDialog]" != ""} {
  207.       XFConfig.$xfClass$xfDialog $xfW config $xfClass $xfLeader
  208.     } {
  209.       if {$xfDialog == 0} {
  210.         XFPacking $xfW $xfType $xfClass $xfLeader
  211.       } {
  212.         if {$xfDialog == 1} {
  213.           XFPlacing $xfW $xfType $xfClass $xfLeader
  214.         } {
  215.           if {$xfDialog == 2} {
  216.             if {"$xfConf(geometry)" == "packer"} {
  217.               XFPacking $xfW $xfType $xfClass $xfLeader
  218.             } {
  219.               XFPlacing $xfW $xfType $xfClass $xfLeader
  220.             }
  221.           } {
  222.             if {$xfDialog == 3} {
  223.               XFBinding $xfW $xfType $xfClass $xfLeader
  224.             }
  225.           }
  226.         }
  227.       }
  228.     }
  229.   } {
  230.     if {"$xfType" == "add"} {
  231.       if {"[info proc XFConfig.${xfClass}4]" != ""} {
  232.         if {$xfConf(onlyOneWindow)} {
  233.           XFConfig.${xfClass}4 $xfW add 0
  234.         } {
  235.           XFConfig.${xfClass}4 $xfW add $xfClass
  236.         }
  237.       }
  238.     } {
  239.       if {[info exists xfDefaultConf([string tolower $xfClass])]} {
  240.         if {"[info proc XFConfig.$xfClass$xfDefaultConf([string tolower $xfClass])]" != ""} {
  241.           if {$xfConf(onlyOneWindow)} {
  242.            XFConfig.$xfClass$xfDefaultConf([string tolower $xfClass]) \
  243.               $xfW config 0
  244.           } {
  245.             XFConfig.$xfClass$xfDefaultConf([string tolower $xfClass]) \
  246.               $xfW config $xfClass
  247.           }
  248.         } {
  249.           if {$xfDefaultConf([string tolower $xfClass]) == 0} {
  250.             XFPacking $xfW $xfType $xfClass $xfLeader
  251.           } {
  252.             if {$xfDefaultConf([string tolower $xfClass]) == 1} {
  253.               XFPlacing $xfW $xfType $xfClass $xfLeader
  254.             } {
  255.               if {$xfDefaultConf([string tolower $xfClass]) == 2} {
  256.                 if {"$xfConf(geometry)" == "packer"} {
  257.                   XFPacking $xfW $xfType $xfClass $xfLeader
  258.                 } {
  259.                   XFPlacing $xfW $xfType $xfClass $xfLeader
  260.                 }
  261.               } {
  262.                 if {$xfDefaultConf([string tolower $xfClass]) == 3} {
  263.                   XFBinding $xfW $xfType $xfClass $xfLeader
  264.                 }
  265.               }
  266.             }
  267.           }
  268.         }
  269.       }
  270.     }
  271.   }
  272. }
  273.  
  274. proc XFProcConfGeometryDefault {{xfW ""} {xfLeader ""}} {
  275. ##########
  276. # Procedure: XFProcConfGeometryDefault
  277. # Description: call default geometry handler
  278. # Arguments: {xfW} - the widget to configure, or empty
  279. #                    to use current widget path
  280. #            {xfLeader} - the leading toplevel
  281. # Returns: none
  282. # Sideeffects: none
  283. ##########
  284.  
  285.   global xfStatus
  286.  
  287.   if {"$xfW" == ""} {
  288.     set xfW $xfStatus(path)
  289.   }
  290.   XFProcConfConfigure $xfW 2 $xfLeader
  291. }
  292.  
  293. proc XFProcConfInsertTemplate {xfName} {
  294. ##########
  295. # Procedure: XFProcConfInsertTemplate
  296. # Description: insert the specified template
  297. # Arguments: xfName - the relative pathname of the template
  298. # Returns: none
  299. # Sideeffects: none
  300. ##########
  301.  
  302.   global xfPath
  303.   global xfStatus
  304.  
  305.   foreach xfPathElement [split $xfPath(templates) :] {
  306.     if {[XFMiscIsFile $xfPathElement/$xfName.t]} {
  307.       XFEditSetStatus "Inserting template [file tail $xfName]..."
  308.       XFPasteFile $xfStatus(path) $xfPathElement/$xfName.t
  309.       XFEditSetStatus "Inserting template [file tail $xfName]...done"
  310.       break
  311.     }
  312.   }
  313. }
  314.  
  315. proc XFProcConfInsertWidgetDefault {xfClass} {
  316. ##########
  317. # Procedure: XFProcConfInsertWidgetDefault
  318. # Description: insert the specified class of widget
  319. # Arguments: xfClass - the class to insert 
  320. # Returns: none
  321. # Sideeffects: none
  322. ##########
  323.  
  324.   global xfStatus
  325.  
  326.   set xfListNum 0
  327.   if {[lsearch $xfStatus(elementList) $xfClass] != -1} {
  328.     set xfListNum 0
  329.   } {
  330.     if {[lsearch $xfStatus(additionalList) $xfClass] != -1} {
  331.       set xfListNum 1
  332.     } {
  333.       set xfListNum 2
  334.     }
  335.   }
  336.   XFEditSetType $xfClass $xfListNum
  337.   XFProcConfAddCurrentItem add
  338. }
  339.  
  340. proc XFProcConfInsertWidgetConfig {xfClass} {
  341. ##########
  342. # Procedure: XFProcConfInsertWidgetConfig
  343. # Description: insert the specified class of widget and configure it
  344. # Arguments: xfClass - the class to insert 
  345. # Returns: none
  346. # Sideeffects: none
  347. ##########
  348.  
  349.   set xfListNum 0
  350.   if {[lsearch $xfStatus(elementList) $xfClass] != -1} {
  351.     set xfListNum 0
  352.   } {
  353.     if {[lsearch $xfStatus(additionalList) $xfClass] != -1} {
  354.       set xfListNum 1
  355.     } {
  356.       set xfListNum 2
  357.     }
  358.   }
  359.   XFEditSetType $xfClass $xfListNum
  360.   XFProcConfAddCurrentItem conf
  361. }
  362.  
  363. proc XFProcConfLayout {} {
  364. ##########
  365. # Procedure: XFProcConfLayout
  366. # Description: call layouting for widgets
  367. # Arguments: none
  368. # Returns: none
  369. # Sideeffects: none
  370. ##########
  371.  
  372.   XFEditSetStatus "Calling layouting..."
  373.   XFLayout
  374.   XFEditSetStatus "Calling layouting...done"
  375. }
  376.  
  377. proc XFProcConfPacking {{xfW ""} {xfLeader ""}} {
  378. ##########
  379. # Procedure: XFProcConfPacking
  380. # Description: call packing for the specified widget
  381. # Arguments: {xfW} - the widget to configure, or empty
  382. #                    to use current widget path
  383. #            {xfLeader} - the leading toplevel
  384. # Returns: none
  385. # Sideeffects: none
  386. ##########
  387.  
  388.   global xfStatus
  389.  
  390.   if {"$xfW" == ""} {
  391.     set xfW $xfStatus(path)
  392.   }
  393.   XFProcConfConfigure $xfW 0 $xfLeader
  394. }
  395.  
  396. proc XFProcConfParametersDefault {{xfW ""} {xfLeader ""}} {
  397. ##########
  398. # Procedure: XFProcConfParametersDefault
  399. # Description: call default configuration dialog for the specified widget
  400. # Arguments: {xfW} - the widget to configure, or empty
  401. #                    to use current widget path
  402. #            {xfLeader} - the leading toplevel
  403. # Returns: none
  404. # Sideeffects: none
  405. ##########
  406.  
  407.   global xfStatus
  408.  
  409.   if {"$xfW" == ""} {
  410.     set xfW $xfStatus(path)
  411.   }
  412.   XFProcConfConfigure $xfW "" $xfLeader
  413. }
  414.  
  415. proc XFProcConfParametersGeneral {{xfW ""} {xfLeader ""}} {
  416. ##########
  417. # Procedure: XFProcConfParametersGeneral
  418. # Description: call general parameter dialog for the specified widget
  419. # Arguments: {xfW} - the widget to configure, or empty
  420. #                    to use current widget path
  421. #            {xfLeader} - the leading toplevel
  422. # Returns: none
  423. # Sideeffects: none
  424. ##########
  425.  
  426.   global xfStatus
  427.  
  428.   if {"$xfW" == "" || "[info commands $xfW]" == ""} {
  429.     set xfW $xfStatus(path)
  430.   }
  431.   XFParameters $xfW $xfLeader
  432. }
  433.  
  434. proc XFProcConfParametersGroups {} {
  435. ##########
  436. # Procedure: XFProcConfParametersGroups
  437. # Description: set parameters for groups of widgets
  438. # Arguments: none
  439. # Returns: none
  440. # Sideeffects: none
  441. ##########
  442.  
  443.   XFEditSetStatus "Calling parameter setting for groups..."
  444.   XFGroups
  445.   XFEditSetStatus "Calling parameter setting for groups...done"
  446. }
  447.  
  448. proc XFProcConfParametersSmall {{xfW ""} {xfLeader ""}} {
  449. ##########
  450. # Procedure: XFProcConfParametersSmall
  451. # Description: call small parameter dialog for the specified widget
  452. # Arguments: {xfW} - the widget to configure, or empty
  453. #                    to use current widget path
  454. #            {xfLeader} - the leading toplevel
  455. # Returns: none
  456. # Sideeffects: none
  457. ##########
  458.  
  459.   global xfStatus
  460.  
  461.   if {"$xfW" == ""} {
  462.     set xfW $xfStatus(path)
  463.   }
  464.   XFProcConfConfigure $xfW 4 $xfLeader
  465. }
  466.  
  467. proc XFProcConfParametersSpecial {{xfW ""} {xfLeader ""}} {
  468. ##########
  469. # Procedure: XFProcConfParametersSpecial
  470. # Description: call special parameter dialog for the specified widget
  471. # Arguments: {xfW} - the widget to configure, or empty
  472. #                    to use current widget path
  473. #            {xfLeader} - the leading toplevel
  474. # Returns: none
  475. # Sideeffects: none
  476. ##########
  477.  
  478.   global xfStatus
  479.  
  480.   if {"$xfW" == ""} {
  481.     set xfW $xfStatus(path)
  482.   }
  483.   XFProcConfConfigure $xfW 5 $xfLeader
  484. }
  485.  
  486. proc XFProcConfPlacing {{xfW ""} {xfLeader ""}} {
  487. ##########
  488. # Procedure: XFProcConfPlacing
  489. # Description: call placing for the specified widget
  490. # Arguments: {xfW} - the widget to configure, or empty
  491. #                    to use current widget path
  492. #            {xfLeader} - the leading toplevel
  493. # Returns: none
  494. # Sideeffects: none
  495. ##########
  496.  
  497.   global xfStatus
  498.  
  499.   if {"$xfW" == ""} {
  500.     set xfW $xfStatus(path)
  501.   }
  502.   XFProcConfConfigure $xfW 1 $xfLeader
  503. }
  504.  
  505. # eof
  506.  
  507.